home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
tsptp.zip
/
RMATH.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-04-09
|
2KB
|
71 lines
(******************************************************************************)
(* RMATH.MOD *)
(* Real Math Benchmark. *)
(******************************************************************************)
PROGRAM Rmath(Output);
(******************************************************************************)
(* TIMING *)
(******************************************************************************)
(*$IFNDEF TopSpeed *)
(*%F TRUE *** Compile for Turbo Pascal ***)
USES TPBench;
(*%E*)
(*$ELSE *** Compile for TopSpeed Pascal ***)
IMPORT TSBench *;
(*$ENDIF *)
(******************************************************************************)
VAR
X, Y : BmReal;
PROCEDURE RealMath;
VAR I : BmInt;
BEGIN
X := 0.0;
Y := 9.9;
FOR I := 1 TO 1000 DO
X := X + ((Y * Y - Y) / Y);
END;
BEGIN
WriteLn('RealMath Benchmark');
(******************************************************************************)
(* Compute the looping overhead. The Dummy procedure must have some side- *)
(* effect so that it is not optimised out of existence. *)
(******************************************************************************)
StartTimer; (* Start the clock. *)
REPEAT
Dummy;
UNTIL NullTimesUp;
(******************************************************************************)
(* Now run the benchmark. Note that the Dummy procedure is also called so *)
(* that we can eliminate its overhead from the looping overhead. *)
(******************************************************************************)
StartTimer; (* Start the clock. *)
REPEAT
RealMath;
Dummy
UNTIL BenchTimesUp;
(******************************************************************************)
ReportTimes;
WriteLn;
WriteLn('Result: X = ', X:10);
END.